#!/bin/bash
#=======================
# Author : Ali Moradzade
# Created: 2021/12/30
#=======================

# using until and while loop
var1=3

until [ $var1 -eq 0 ]
do
	echo "Outer loop: $var1"
	var2=1
	while [ $var2 -lt 5 ]
	do
		var3=$(echo "scale=4; $var1 / $var2" | bc | sed 's/^\./0./') # use sed to print 0.2 instead of .2
		echo "   Inner loop: $var1 / $var2 = $var3"
		var2=$[ $var2 + 1 ]
	done
	var1=$[ $var1 - 1 ]
done
